package com.yanqu.road.server.cmd.activity.douluodalu;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.DouLuoDaLuPb;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.activity.douluodalu.DouLuoDaLuProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.douluodalu.CrossDouLuoDaLuMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_DOU_LUO_DA_LU_GET_USER_DATA, desc = "玩家数据")
public class CrossDouLuoDaLuGetUserDataCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        DouLuoDaLuProto.DouLuoDaLuGetUserDataCrossReqMsg reqMsg = DouLuoDaLuProto.DouLuoDaLuGetUserDataCrossReqMsg.parseFrom(packet.getBytes());

        UserBaseInfo userBaseInfo = PlayerBasePb.parseToUserBaseInfo(reqMsg.getPlayerInfo());
        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.U_DOU_LUO_DA_LU_GET_USER_DATA,
                CrossDouLuoDaLuMgr.getUserMsg(reqMsg.getActivityId(), packet.getPlayerId(), reqMsg.getAllPatronsEarn(), userBaseInfo,
                        DouLuoDaLuPb.parseUserPatrons(reqMsg.getAllPatronsList()), reqMsg.getMallInfoList(), reqMsg.getIsEnter())));
    }

    @Override
    public void sendData() {

    }
}
